package rc.alfresco.users;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by IntelliJ IDEA.
 * User: Slejus
 * Date: 13.11.27
 * Time: 15.52
 * To change this template use File | Settings | File Templates.
 */
public class ExecuteRcUserUpdate {

    private static final Logger logger = Logger.getLogger(ExecuteRcUserUpdate.class);

    public ExecuteRcUserUpdate(){}

    public static void execute(String username) {
        logger.debug("Started EXECUTE RC USER UPDATE");
        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alfresco/extension/my-script-context.xml");
        UpdateRcUser updateUser = (UpdateRcUser)context.getBean("updateRcUser"); // DB operations object
        updateUser.updateUserProfile(username);
        logger.debug("Ended EXECUTE RC USER UPDATE");
    }
}
